package com.example.demo.pojo.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 叮当猫的百宝箱
 * @since 1.0
 */
@Data
public class CreateOrUpdateBannerRequest implements Serializable {

    private static final long serialVersionUID = -2363140357905078210L;

    /**
     * 关联的资源ID
     */
    @Schema(description = "资源ID")
    @NotNull(message = "资源ID不能为空!")
    private Long resourceId;

    /**
     * 轮播图标题
     */
    @Schema(description = "轮播图标题")
    private String title;

    /**
     * 跳转链接
     */
    @Schema(description = "跳转链接")
    @Pattern(regexp = "^(https?://).*", message = "跳转链接必须是一个合法的URL地址")
    private String link;

    /**
     * 是否长期有效
     */
    @Min(value = 0, message = "是否长期有效只能是 0 或 1")
    @Max(value = 1, message = "是否长期有效只能是 0 或 1")
    @Schema(description = "是否长期有效")
    private Integer permanent;

    /**
     * 生效日期
     */
    @Schema(description = "生效日期")
    private LocalDateTime validFrom;

    /**
     * 失效日期
     */
    @Schema(description = "失效日期")
    private LocalDateTime validTo;
}
